clear; clc;

%% Preset Parameters
% Benchmark Parameters
StdVec          =   [1 1 1 -1 -1 60 -10]'*0.01/4;
Param_Benchmark =   struct('KAPPA',0.00/4,'XI',1/82.5/4,'Pir_SS',0.02/4,...
                            'Flag_dE',0,'Flag_Price',0,...
                            'B_Total_SS',0.91,'b_lb',-0.29,...
                            'TrProb_H',0.96,'Prob_H',0.37,...
                            'TrProb_ext',0.92,'Prob_ext',0.33,...
                            'Fin_DomShare',0.79,'Fin_AdjCost',0.80,...
                            'Cons_FracH',0.60,...
                            'WGap_ext',0,'WGap_H',0,...
                            'RHO_M_dom',0.68,'RHO_M_ext',0.81,'RHO_Y_H',0.50,'RHO_p_F',0.90,...
                            'Taylor_Pi',1.1,'Taylor_ir',0.87,...
                            'Cons_ElasTN',6.19,'Cons_ElasHF',6.19);
% International Integration Degrees
List_WGap_ext   =   (-0.25:0.05:0.25)';
Num_Fin         =   length(List_WGap_ext);

List_WGap_H     =   (-0.25:0.05:0.25)';
Num_Real        =   length(List_WGap_H);


%% Generate Different Results
% Financial Integration
SOLUTION_Fin    =   cell(Num_Fin,1);

for ii=1:Num_Fin
    fprintf(['\n\nSolving the model with Different Corr, by FI: ',num2str(ii),'\n\n']);
    TempParam           =   Param_Benchmark;
    TempParam.WGap_ext  =   List_WGap_ext(ii);
    
    SOLUTION_Fin{ii}    =   Solver_Main(Setup_PP(TempParam),StdVec);
end

% Real Integration
SOLUTION_Real   =   cell(Num_Real,1);

for ii=1:Num_Real
    fprintf(['\n\nSolving the model with Different Corr, by RI: ',num2str(ii),'\n\n']);
    TempParam           =   Param_Benchmark;
    TempParam.WGap_H    =   List_WGap_H(ii);
    
    SOLUTION_Real{ii}   =   Solver_Main(Setup_PP(TempParam),StdVec);
end

save('Results_DifferentCorr.mat','SOLUTION_Fin','SOLUTION_Real','-v7.3');
